<template>
  <ul class="card-list flex flex-wrap">
    <li class="card-item" v-for="item in cardList" :key="item.id">
      <router-link :to="item.url" class="card-item-link">
        <section class="card-img-wrap">
          <section class="card-img">
            <img :src="item.cover_url" alt="图片" />
          </section>
          <section class="mark"></section>
          <section class="icon">
            <PlayVue color="#fff"></PlayVue>
          </section>
        </section>
        <p class="card-title text-ellipsis font-m">{{ item.title }}</p>
        <p class="card-person text-ellipsis font-sm" v-show="item.is_about_show">
          {{ item.tag }}
        </p>
      </router-link>
    </li>
  </ul>
</template>

<script lang="ts" setup>
import { toRefs, computed } from "vue";

import PlayVue from "@/components/icon/Play.vue";

const props = defineProps({
  cardList: {
    type: Array as any,
    default: [] as any
  },
});
</script>

<style scoped lang="scss">
.card-item {
  position: relative;
  margin: 0px 20px 34px 0;
}

.card-item:nth-child(3n) {
  margin-right: 0px;
}

.mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  transition: all 0.36s ease;
}

.card-item:hover .mark {
  background-color: rgba(0, 0, 0, 0.47);
}

.card-item:hover .icon {
  top: 50%;
}

.card-item-nomargin {
  margin-right: 0px;
}

.card-item-link {
  display: block;
  width: 466px;
}

.card-img-wrap {
  position: relative;
  width: 466px;
  height: 262px;
  border: 2px solid #000000;
  border-radius: 12px;
  box-shadow: 0px 9px 22px 2px rgba(96, 102, 118, 0.35);
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 258px;
}

.card-img img {
  display: block;
  width: 100%;
  height: 100%;
}

.icon {
  position: absolute;
  top: -30%;
  left: 50%;
  transition: all 0.6s ease;
  transform: translate(-50%, -50%);
}

.card-title {
  height: 40px;
  line-height: 40px;
  color: #1c1c1c;
}

.card-person {
  height: 28px;
  line-height: 28px;
  color: #606676;
}
</style>
